package com.iflytek.universitymanagement.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.iflytek.universitymanagement.domain.LearningPlan;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface LearningPlanMapper extends BaseMapper<LearningPlan> {

    // 根据学生ID和科目查询学习计划
    @Select("SELECT * FROM learning_plan WHERE student_id = #{studentId} AND subject = #{subject}")
    List<LearningPlan> selectLearningPlansByStudentIdAndSubject(@Param("studentId") Integer studentId, @Param("subject") String subject);

    // 根据学生ID和科目删除学习计划
    @Delete("DELETE FROM learning_plan WHERE student_id = #{studentId} AND subject = #{subject}")
    int deleteLearningPlansByStudentIdAndSubject(@Param("studentId") Integer studentId, @Param("subject") String subject);
}
